<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
	<meta charset="UTF-8">
	<title>报名活动详情页</title>
	<meta name="page-view-size" content="1280*720">
	<link rel="stylesheet" href="css/base.css">
	<link rel="stylesheet" href="css/A_teamGroupDetail.css">
	<script type="text/javascript" src="lib/js/evm.js"></script>
	<script type="text/javascript" src="lib/js/Evm_djyw.js"></script>
	<script type="text/javascript" src="lib/js/key.js"></script>
	<script src="lib/js/md5.js" type="text/javascript" charset="utf-8"></script>
	<script src="lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/api.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
	<div class="theoretical-bg" id="theoreticalMain">
		<div id="white-bg"></div>
		<div id="blue-bg"></div>
		<div class="model">
			<img class="imgs" src="" alt="">
			<!-- <div class="alearts">按确认键查看图集</div> -->
		</div>
		<div class="model">我要报名</div>
		<div class="status">进行中</div>
		<div class="info">
			<div class="title"></div>
		</div>
		<div class="item">
			<!-- <div class="baotime"></div> -->
			<div class="starttime"></div>
			<div class="address"></div>
			<div class="contacts"></div>
			<!-- <div class="situation"></div> -->
			<!-- <div class="contacts"></div> -->
			<!-- <div>
				<div class="yellow">简介：</div>
			</div> -->
		</div>
		<div class="model">
			<div class="container" id="container">
				<div class="content" id="content">

				</div>
			</div>
		</div>
		<div class="bm_border">
			<div><img class="erweima" src="" alt=""></div>
			<div>微信扫码报名</div>
		</div>
	</div>
</body>
<script>
	var modelIndex = {
		disUser: false,
		specialState: 'didi',
		index: 2, //初始位置
		listName: 'model', //模块名称
		containerId: 'theoreticalMain', //包含模块的标签id
		thisContain: 'container', //翻滚外容器
		thisDetail: 'content', //翻滚内容
	}
	var articleRun;

	function getMessage() {
		var param = {
			id: TV.GetParam('id'),
			area_id: $.cookie('TV_CST_AREA'),
			// access_token: $.cookie("TV_CST_TOKEN"),

		}
		GetDatas("volunteer", param, function (err, res) {
			mess = res.data;
			$('.title').html(mess.title);

			$('.baotime').html(" <div class=yellow>队长</div>: " + mess.master);
			//          $('.title').html("好人宣德馆文化服务活动");
			$('.endtime').html(" <div class=yellow>结束时间</div>: " + mess.format_end_time);
			// $('.starttime').html(" <div class=yellow>活动时间</div>: " + mess.format_start_time + ' 至 ' + mess
			// 	.format_end_time);
			// $('.address').html('<div class=yellow>活动地点</div>：' + mess.address);
			$('.situation').html('<div class=yellow>报名情况</div>：已报名' + mess.bm_count + '人/限' + 100 + "人报名");
			$('.contacts').html('<div class=yellow>联&nbsp;&nbsp;系&nbsp;&nbsp;人&nbsp;</div>: ' + mess.master +' '+ mess.mobile);

			// $('.phone').html('<div class=yellow>联系方式&nbsp;&nbsp;</div>: ' + mess.phone);
			// $('.status').html(mess.status == 0 ? '未开始' : (mess.status == 1 ? '进行中' : '已结束'));



			$('.content').html("<span >团队介绍：</span>"+mess.condition+"</br ><span>加入条件：</span>"+mess.content);
			$('.imgs').attr('src',mess.logo ? (API_URL.imgURL + mess.logo):"images/default.png");
			// $('.').html(mess.);
			var surl = API_URL.loginURL + "home/index/qrcode?url=" + encodeURIComponent(
				API_URL.Group + '/' + TV.GetParam('id'))
            $('.erweima').attr('src', surl)
		})
		// right.toggleFocus();
	}

	getMessage();

	function direOpt(index, directive) {
		if (directive == "up") { //上
			console.log('toptop')
			if (index == 2) { //文章翻滚
				TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
			}
		} else if (directive == "down") { //下
			console.log('downdown', index)
			if (index == 2) { //文章翻滚
				console.log(directive, modelIndex.thisContain, modelIndex.thisDetail, '21212')
				TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
			}
		} else { //左
			// index = index == 1 ? 2 : 1;
			// clearInterval(articleRun);
		}
		return index;
	}

	function direEnter(index) {
		console.log(index)
		if (index == 0) {
			// window.location.href = './carrousel.html?id=' + TV.GetParam('id') + '&type=activety';
		} else if (index == 1) { //点单预约
			var params = {
				id: TV.GetParam('id'),
				name: EVM.cookie.getValue('TV_CST_NAME'),
				mobile: EVM.cookie.getValue('TV_CST_MOBILE'),
				access_token: $.cookie('TV_CST_TOKEN'),
			}
			if (mess.status == 2) {
				GetDatas('like', params, function (err, res) {
					resOpt.call(this, res)
				});
			} else {
				if (mess.is_bm == "99") {
					GetDatas('getReservation', params, function (err, res) {
						resOpt.call(this, res)
					});
				} else {
					GetDatas('like', params, function (err, res) {
						resOpt.call(this, res)
					});
				}

			}

		}
	}

	function resOpt(res) {
		// console.log(res)
		if (res.code == 0) {
			if (mess.status == 2) {
				TV.PromptMsg('点赞成功');
				var param = {
					id: TV.GetParam('id'),
					area_id: $.cookie('TV_CST_AREA')
				}
				GetDatas('getActivity', param, function (err, res) {
					mess = res.data;

					$(".like").html("点赞:" + mess.likes)
				})
			} else {
				getMessage()
				TV.PromptMsg('已成功，请耐心等待')
				setTimeout(function () {
					window.history.go(-1)
				}, 2000);
			}

		} else if (res.code == 10002) {
			TV.userLogin();
			direEnter(index);
		} else {
			TV.PromptMsg(res.message)
		}
	}
</script>
<script type="text/javascript" src="js/index.js"></script>

</html>